﻿using DalEx;
using Model;
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Manager_EditSignTable : System.Web.UI.PageEx
{
    private string strPageCode = "B00001";
    private string strLoginResult = string.Empty;
    private DataSet ds = null;
    public static string strId = "0";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!DalEx.DbManagerEx.CheckLoginRight(UserType, UserId, strPageCode, ref strLoginResult))
        {
            MessageBox(strLoginResult);
            //FineUI.Alert.Show(strLoginResult, FineUI.MessageBoxIcon.Warning);
            Response.Redirect("Login.aspx");
        }
        if (!Page.IsPostBack)
        {
            DataBinds();
        }
    }
    private void DataBinds()
    {
        if (!string.IsNullOrEmpty(Request.QueryString["Id"]))
        {
            strId = Request.QueryString["Id"].ToString();
        }
        int iUserId = 0;
        int.TryParse(strId, out iUserId);
        Model.DbCompInfo dbCompInfo = DalEx.DbCompInfoEx.GetModel("BaoMing");
        if (dbCompInfo != null)
        {
            setMeta("学生入园报名表", dbCompInfo.CKeywords, dbCompInfo.CDescription);
        }
        #region 绑定类型
        rblClass.Items.Clear();
        rblClass.Items.Add(new ListItem("小班", "0"));
        //rblClass.Items.Add(new ListItem("中班", "1"));
        //rblClass.Items.Add(new ListItem("大班", "2"));
        //rblClass.Items.Add(new ListItem("大大班", "3"));

        rblCensusClass.Items.Clear();
        //rblCensusClass.Items.Add(new ListItem("龙岗", "0"));
        //rblCensusClass.Items.Add(new ListItem("深圳其他区", "1"));
        rblCensusClass.Items.Add(new ListItem("深户", "1"));
        rblCensusClass.Items.Add(new ListItem("非深户", "2"));
        rblCensusClass.Items.Add(new ListItem("港籍", "3"));
        rblCensusClass.Items.Add(new ListItem("台籍", "4"));
        rblCensusClass.Items.Add(new ListItem("澳籍", "5"));
        //rblCensusClass.Items.Add(new ListItem("外籍", "6"));

        rbtHouseNature.Items.Clear();
        //rbtHouseNature.Items.Add(new ListItem("自建房", "0"));
        rbtHouseNature.Items.Add(new ListItem("购房", "1"));
        //rbtHouseNature.Items.Add(new ListItem("租房", "2"));
        //rbtHouseNature.Items.Add(new ListItem("单位房", "3"));
        //rbtHouseNature.Items.Add(new ListItem("亲友房", "4"));
        rbtHouseNature.Items.Add(new ListItem("其他", "5"));

        rbtPlanning.Items.Clear();
        rbtPlanning.Items.Add(new ListItem("独生子女", "0"));
        //rbtPlanning.Items.Add(new ListItem("非独生子女", "1"));
        //rbtPlanning.Items.Add(new ListItem("超生但办理罚款手续", "2"));
        //rbtPlanning.Items.Add(new ListItem("超生未办理罚款手续", "3"));
        rbtPlanning.Items.Add(new ListItem("政策内二孩", "4"));
        rbtPlanning.Items.Add(new ListItem("政策外但已接受处理的幼儿", "5"));

        //rbtCaseType.Items.Clear();
        //rbtCaseType.Items.Add(new ListItem("住得近", "0"));
        //rbtCaseType.Items.Add(new ListItem("收费合理", "1"));
        //rbtCaseType.Items.Add(new ListItem("办学质量好", "2"));
        //rbtCaseType.Items.Add(new ListItem("环境好", "3"));
        //rbtCaseType.Items.Add(new ListItem("师资好", "4"));
        //rbtCaseType.Items.Add(new ListItem("家长口碑好", "5"));
        //rbtCaseType.Items.Add(new ListItem("社会口碑好", "6"));
        //rbtCaseType.Items.Add(new ListItem("别无选择", "7"));

        rbtNurserySchool.Items.Clear();
        rbtNurserySchool.Items.Add(new ListItem("龙岗区机关幼儿园本部", "0"));
        rbtNurserySchool.Items.Add(new ListItem("龙岗区机关幼儿园龙城分园", "1"));
        rbtNurserySchool.Items.Add(new ListItem("龙岗区机关幼儿园南湾分园", "2"));
        rbtNurserySchool.Items.Add(new ListItem("龙岗区机关幼儿园坂田分园", "3"));
        #endregion

        Model.BaoMing M_BaoMing = Dal.BaoMingDal.Select(iUserId);
        if (M_BaoMing != null)
        {
            hfSelectId.Value = M_BaoMing.Id.ToString();
            txtUserName.Text = M_BaoMing.UserName;
            rblSex.SelectedIndex = rblSex.Items.IndexOf(rblSex.Items.FindByValue(M_BaoMing.Sex.ToString()));
            calBirthday.Text = M_BaoMing.Birthday.ToString("yyyy-MM-dd");
            txtPlaceOrigin.Text = M_BaoMing.PlaceOrigin;
            txtPlaceBirth.Text = M_BaoMing.PlaceBirth;
            //rblClass.SelectedIndex = rblClass.Items.IndexOf(rblClass.Items.FindByValue(M_BaoMing.RegClass.ToString()));
            txtIdCardNo.Text = M_BaoMing.IdCardNo;
            rblCensusClass.SelectedIndex = rblCensusClass.Items.IndexOf(rblCensusClass.Items.FindByValue(M_BaoMing.CensusClass.ToString()));
            txtCensusProvince.Text = M_BaoMing.CensusProvince;
            txtCensusCity.Text = M_BaoMing.CensusCity;
            txtCensusArea.Text = M_BaoMing.CensusArea;
            txtCensusPoliceStation.Text = M_BaoMing.CensusPoliceStation;
            rbtIsInSchool.SelectedIndex = rbtIsInSchool.Items.IndexOf(rbtIsInSchool.Items.FindByValue(M_BaoMing.IfInSchool.ToString()));
            txtHadInSchool.Text = M_BaoMing.InSchoolInfo;
            txtAllergicHistory.Text = M_BaoMing.AllergicHistory;
            txtSepcialDisease.Text = M_BaoMing.SepcialDisease;
            txtFatherName.Text = M_BaoMing.FatherName;
            txtFatherWorks.Text = M_BaoMing.FatherWorks;
            txtFatherTel.Text = M_BaoMing.FatherTel;
            rblFatherInSZ.SelectedIndex = rblFatherInSZ.Items.IndexOf(rblFatherInSZ.Items.FindByValue(M_BaoMing.FatherInSZ.ToString()));
            rblFatherPaySB.SelectedIndex = rblFatherPaySB.Items.IndexOf(rblFatherPaySB.Items.FindByValue(M_BaoMing.FatherPaySB.ToString()));
            rblFatherPayJZZ.SelectedIndex = rblFatherPayJZZ.Items.IndexOf(rblFatherPayJZZ.Items.FindByValue(M_BaoMing.FatherPayJZZ.ToString()));
            txtMotherName.Text = M_BaoMing.MotherName;
            txtMotherWorks.Text = M_BaoMing.MotherWorks;
            txtMotherTel.Text = M_BaoMing.MotherTel;
            rblMotherInSZ.SelectedIndex = rblMotherInSZ.Items.IndexOf(rblMotherInSZ.Items.FindByValue(M_BaoMing.MotherInSZ.ToString()));
            rblMotherPaySB.SelectedIndex = rblMotherPaySB.Items.IndexOf(rblMotherPaySB.Items.FindByValue(M_BaoMing.MotherPaySB.ToString()));
            rblMotherPayJZZ.SelectedIndex = rblMotherPayJZZ.Items.IndexOf(rblMotherPayJZZ.Items.FindByValue(M_BaoMing.MotherPayJZZ.ToString()));
            txtFatherCardNo.Text = M_BaoMing.FatherCardNo;
            txtMotherCardNo.Text = M_BaoMing.MotherCardNo;
            rbtNurserySchool.SelectedIndex = rbtNurserySchool.Items.IndexOf(rbtNurserySchool.Items.FindByValue(M_BaoMing.NurserySchool.ToString()));
            if (rbtNurserySchool.SelectedIndex == 2) { 
                rblClass.Items.Clear();
                rblClass.Items.Add(new ListItem("小班", "0"));
                rblClass.Items.Add(new ListItem("中班", "1"));
                rblClass.Items.Add(new ListItem("大班", "2"));
            }
            rblClass.SelectedIndex = rblClass.Items.IndexOf(rblClass.Items.FindByValue(M_BaoMing.RegClass.ToString()));
            loadHouseRegion_rbt();
            hfHouseRegionID.Value = M_BaoMing.HouseRegionID.ToString();
            string houseAddr = M_BaoMing.HouseAddr;
            if (M_BaoMing.HouseNature == 1 && M_BaoMing.HouseRegionID > 0)
            {
                loadHouseGroup_rbt(M_BaoMing.HouseRegionID.ToString());
                if (M_BaoMing.HouseGroupID > 0)
                {
                    loadHouseNumber_rbt(M_BaoMing.HouseGroupID.ToString());
                    loadHouseNumber1_rbt(M_BaoMing.HouseGroupID.ToString());
                    loadHouseNumber2_rbt(M_BaoMing.HouseGroupID.ToString());
                }
                if (M_BaoMing.HouseNumber1 > 0)
                {
                    DbHouseNumber hn = Dal.DbHouseNumberDal.Select(M_BaoMing.HouseNumber1);
                    houseAddr += hn.HouseNumberName;
                }
                if (M_BaoMing.HouseNumber2 > 0)
                {
                    DbHouseNumber hn = Dal.DbHouseNumberDal.Select(M_BaoMing.HouseNumber2);
                    houseAddr += hn.HouseNumberName;
                }
                if (M_BaoMing.HouseNumberID > 0)
                {
                    houseAddr += "室";
                }
                rbtHouseRegion.SelectedIndex = rbtHouseRegion.Items.IndexOf(rbtHouseRegion.Items.FindByValue(M_BaoMing.HouseRegionID.ToString()));
                rbtHouseGroup.SelectedIndex = rbtHouseGroup.Items.IndexOf(rbtHouseGroup.Items.FindByValue(M_BaoMing.HouseGroupID.ToString()));
                rbtHouseNumber.SelectedIndex = rbtHouseNumber.Items.IndexOf(rbtHouseNumber.Items.FindByValue(M_BaoMing.HouseNumberID.ToString()));
                rbtHouseNumber1.SelectedIndex = rbtHouseNumber1.Items.IndexOf(rbtHouseNumber1.Items.FindByValue(M_BaoMing.HouseNumber1.ToString()));
                rbtHouseNumber2.SelectedIndex = rbtHouseNumber2.Items.IndexOf(rbtHouseNumber2.Items.FindByValue(M_BaoMing.HouseNumber2.ToString()));
                hfHouseRegion.Value = M_BaoMing.HouseRegionID.ToString();
                hfHouseGroup.Value = M_BaoMing.HouseGroupID.ToString();
                hfHouseNumber.Value = M_BaoMing.HouseNumberID.ToString();
                hfHouseNumber1.Value = M_BaoMing.HouseNumber1.ToString();
                hfHouseNumber2.Value = M_BaoMing.HouseNumber2.ToString();
            }
            txtHouseAddr.Text = houseAddr;

            rbtHouseNature.SelectedIndex = rbtHouseNature.Items.IndexOf(rbtHouseNature.Items.FindByValue(M_BaoMing.HouseNature.ToString()));
            calBuyHouseDate.Text = M_BaoMing.BuyHouseDate.ToString("yyyy-MM-dd");
            rbtPlanning.SelectedIndex = rbtPlanning.Items.IndexOf(rbtPlanning.Items.FindByValue(M_BaoMing.Planning.ToString()));           
            txtNotes.Text = M_BaoMing.Notes;
            txtSignName.Text = M_BaoMing.SignName;
            txtSignDate.Text = M_BaoMing.SignDate.ToString("yyyy-MM-dd");
        }
    }
    public int ReadStringToInt(string str)
    {
        if (string.IsNullOrEmpty(str))
        {
            str = "0";
        }
        return Convert.ToInt32(str);
    }

    public DateTime ReadStringToDate(string str)
    {
        if (string.IsNullOrEmpty(str))
        {
            str = DateTime.Now.ToString("yyyy-MM-dd");
        }
        return Convert.ToDateTime(str);
    }

    public decimal ReadStringToDecimal(string str)
    {
        if (string.IsNullOrEmpty(str))
        {
            str = "0";
        }
        return Convert.ToDecimal(str);
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        short sSex = 0, sRegClass = 0, sCensusClass = 0, sIfInSchool = 0, sFatherInSZ = 0, sFatherPaySB = 0, sFatherPayJZZ = 0;
        short sMotherInSZ = 0, sMotherPaySB = 0, sMotherPayJZZ = 0, sHouseNature = 0, sPlanning = 0;
        short sHouseRegion = 0, sHouseGroup = 0, sHouseNumber = 0, sHouseNumber1 = 0, sHouseNumber2 = 0, sHouseAreaID = 0;
        int iChildCounts = 0, iChildIndex = 0, iSelectId = 0;
        DateTime dtBirthday = SqlHelper.MinDate, dtBuyHouseDate = SqlHelper.MinDate, dtRentHouseDate = SqlHelper.MinDate, dtSignDate = SqlHelper.MinDate;
        string strOrderSN = WebBase.Comm.GetOrderNo("ZC");
        string strUserName = SqlHelper.String(txtUserName.Text);
        short.TryParse(rblSex.SelectedValue, out sSex);
        if (!string.IsNullOrEmpty(calBirthday.Text))
            DateTime.TryParse(calBirthday.Text, out dtBirthday);
        string strPlaceOrigin = SqlHelper.String(txtPlaceOrigin.Text);
        string strPlaceBirth = SqlHelper.String(txtPlaceBirth.Text);
        short.TryParse(rblClass.SelectedValue, out sRegClass);
        string strIdCardNo = SqlHelper.String(txtIdCardNo.Text);
        short.TryParse(rblCensusClass.SelectedValue, out sCensusClass);
        //string strCensusAddr = SqlHelper.String(txtCensusAddr.Text);
        string censusProvince = SqlHelper.String(txtCensusProvince.Text);
        string censusCity = SqlHelper.String(txtCensusCity.Text);
        string censusArea = SqlHelper.String(txtCensusArea.Text);
        string censusPoliceStation = SqlHelper.String(txtCensusPoliceStation.Text);  
        short.TryParse(rbtIsInSchool.SelectedValue, out sIfInSchool);
        string strHadInSchool = SqlHelper.String(txtHadInSchool.Text);
        string strAllergicHistory = SqlHelper.String(txtAllergicHistory.Text);
        string strSepcialDisease = SqlHelper.String(txtSepcialDisease.Text);
        string strFatherName = SqlHelper.String(txtFatherName.Text);
        string strFatherWorks = SqlHelper.String(txtFatherWorks.Text);
        string strFatherTel = SqlHelper.String(txtFatherTel.Text);
        short.TryParse(rblFatherInSZ.SelectedValue, out sFatherInSZ);
        short.TryParse(rblFatherPaySB.SelectedValue, out sFatherPaySB);
        short.TryParse(rblFatherPayJZZ.SelectedValue, out sFatherPayJZZ);
        string strMotherName = SqlHelper.String(txtMotherName.Text);
        string strMotherWorks = SqlHelper.String(txtMotherWorks.Text);
        string strMotherTel = SqlHelper.String(txtMotherTel.Text);
        short.TryParse(rblMotherInSZ.SelectedValue, out sMotherInSZ);
        short.TryParse(rblMotherPaySB.SelectedValue, out sMotherPaySB);
        short.TryParse(rblMotherPayJZZ.SelectedValue, out sMotherPayJZZ);
        //string strHouseAddr = SqlHelper.String(txtHouseAddr.Text);
        short.TryParse(rbtHouseNature.SelectedValue, out sHouseNature);
        if (!string.IsNullOrEmpty(calBuyHouseDate.Text))
            DateTime.TryParse(calBuyHouseDate.Text, out dtBuyHouseDate);
        //int.TryParse(txtChildCounts.Text, out iChildCounts);
        //int.TryParse(txtChildIndex.Text, out iChildIndex);
        string strCaseType = string.Empty;
        string strNotes = SqlHelper.String(txtNotes.Text);
        string strSignName = SqlHelper.String(txtSignName.Text);
        int.TryParse(hfSelectId.Value, out iSelectId);
        dtSignDate = DateTime.Now;

        short.TryParse(rbtPlanning.SelectedValue, out sPlanning);

        short sNurserySchool = 0;
        short.TryParse(rbtNurserySchool.SelectedValue, out sNurserySchool);        

        string strFatherCardNo = SqlHelper.String(txtFatherCardNo.Text);
        string strMotherCardNo = SqlHelper.String(txtMotherCardNo.Text);
        string strHouseAddr = "";
        if (rbtHouseNature.SelectedValue == "1" && hfHouseRegionID.Value != "other")
        {
            strHouseAddr = "深圳市龙岗区";
            strHouseAddr += SqlHelper.String(hfHouseRegion.Value);
            strHouseAddr += SqlHelper.String(hfHouseGroup.Value);
            strHouseAddr += SqlHelper.String(hfHouseNumber.Value);
            short.TryParse(hfHouseRegionID.Value, out sHouseRegion);
            if (sHouseRegion == 0)
            {
                MessageBox("请正确选择住房地址所在的小区！"); return;
            }
            short.TryParse(hfHouseGroupID.Value, out sHouseGroup);
            if (sHouseGroup == 0)
            {
                MessageBox("请正确选择住房地址所在的楼栋！"); return;
            }
            short.TryParse(hfHouseNumberID.Value, out sHouseNumber);
            short.TryParse(hfHouseNumberID1.Value, out sHouseNumber1);
            short.TryParse(hfHouseNumberID2.Value, out sHouseNumber2);
            if (hfHouseNumber.Value.Equals("请选择") && sHouseNumber == 0)
            {
                MessageBox("请正确选择住房地址！"); return;
            }
            if (hfHouseNumber1.Value.Equals("请选择") && sHouseNumber1 == 0)
            {
                MessageBox("请正确选择住房地址！"); return;
            }
            if (hfHouseNumber2.Value.Equals("请选择") && sHouseNumber2 == 0)
            {
                MessageBox("请正确选择住房地址！"); return;
            }

        }
        else
        {
            if (string.IsNullOrEmpty(txtHouseAddr.Text))
            {
                MessageBox("请填写家庭住址！");
                return;
            }
            strHouseAddr = SqlHelper.String(txtHouseAddr.Text);
        }
        if (!string.IsNullOrEmpty(calBuyHouseDate.Text))
            DateTime.TryParse(calBuyHouseDate.Text, out dtBuyHouseDate);
       

        if (string.IsNullOrEmpty(strFatherName) && string.IsNullOrEmpty(strMotherName))
        {
            MessageBox("父母亲至少要填写一项！");
            return;
        }
        else
        {

            //foreach (ListItem lItem in rbtCaseType.Items)
            //{
            //    if (lItem.Selected)
            //        strCaseType += lItem.Value + ",";
            //}
            //if (strCaseType.EndsWith(","))
            //    strCaseType = strCaseType.TrimEnd(',');

            Model.BaoMing baoMing = Dal.BaoMingDal.Select(iSelectId);
            //baoMing.OrderNO = strOrderSN;
            baoMing.UserName = strUserName;
            baoMing.Sex = sSex;
            baoMing.Birthday = dtBirthday;
            baoMing.PlaceOrigin = strPlaceOrigin;
            baoMing.PlaceBirth = strPlaceBirth;
            baoMing.RegClass = sRegClass;
            baoMing.IdCardNo = strIdCardNo;
            baoMing.CensusClass = sCensusClass;
            //baoMing.CensusAddr = strCensusAddr;
            baoMing.CensusProvince = censusProvince;
            baoMing.CensusCity = censusCity;
            baoMing.CensusArea = censusArea;
            baoMing.CensusPoliceStation = censusPoliceStation;
            baoMing.IfInSchool = sIfInSchool;
            baoMing.InSchoolInfo = strHadInSchool;
            baoMing.AllergicHistory = strAllergicHistory;
            baoMing.SepcialDisease = strSepcialDisease;
            baoMing.FatherName = strFatherName;
            baoMing.FatherWorks = strFatherWorks;
            baoMing.FatherTel = strFatherTel;
            baoMing.FatherInSZ = sFatherInSZ;
            baoMing.FatherPaySB = sFatherPaySB;
            baoMing.FatherPayJZZ = sFatherPayJZZ;
            baoMing.MotherName = strMotherName;
            baoMing.MotherWorks = strMotherWorks;
            baoMing.MotherTel = strMotherTel;
            baoMing.MotherInSZ = sMotherInSZ;
            baoMing.MotherPaySB = sMotherPaySB;
            baoMing.MotherPayJZZ = sMotherPayJZZ;
            baoMing.HouseAddr = strHouseAddr;
            baoMing.HouseNature = sHouseNature;
            baoMing.HouseRegionID = sHouseRegion;
            baoMing.HouseGroupID = sHouseGroup;
            baoMing.HouseNumberID = sHouseNumber;
            baoMing.HouseNumber1 = sHouseNumber1;
            baoMing.HouseNumber2 = sHouseNumber2;
            baoMing.BuyHouseDate = dtBuyHouseDate;
            baoMing.RentHouseDate = dtRentHouseDate;
            baoMing.Planning = sPlanning;
            baoMing.ChildCounts = iChildCounts;
            baoMing.ChildIndex = iChildIndex;
            baoMing.CaseType = strCaseType;
            baoMing.SignName = strSignName;
            baoMing.SignDate = dtSignDate;
            baoMing.Notes = strNotes;
            //baoMing.AddTime = DateTime.Now;
            baoMing.Photos = string.Empty;

            baoMing.FatherCardNo = strFatherCardNo;
            baoMing.MotherCardNo = strMotherCardNo;

            baoMing.NurserySchool = sNurserySchool;

            //baoMing.Status = 0;
            Dal.BaoMingDal.Update(baoMing);
            MessageBox1("修改成功！！！", "EditSignTable.aspx");
            //FineUI.Alert.Show("修改成功！！！", FineUI.MessageBoxIcon.Information);
            //int iResult = 0;
            //string strResult = string.Empty;
            //iResult = DalEx.BaoMingEx.Insert(baoMing, ref strResult);
            //if (iResult > 0)
            //{
            //    MessageBox(strResult, "Signning.aspx");
            //}
            //else
            //{
            //    MessageBox(strResult);
            //}
        }

    }
    private void setMeta(string title, string key, string des)
    {
        string strWebTitle = string.Empty, strWebKeywords = string.Empty, strWebDescription = string.Empty;
        Model.DbSystem dbSystem = Dal.DbSystemDal.Select(1);
        if (dbSystem != null)
        {
            strWebTitle = dbSystem.STitle;
            strWebKeywords = dbSystem.SKeywords;
            strWebDescription = dbSystem.SDescription;
        }
        HtmlMeta keywords = new HtmlMeta(); // keywords
        HtmlMeta description = new HtmlMeta(); // description
        keywords.Name = "keywords";
        keywords.Content = string.IsNullOrEmpty(key) ? strWebKeywords : key;

        this.Title = string.IsNullOrEmpty(title) ? strWebTitle : title;

        description.Name = "description";
        description.Content = string.IsNullOrEmpty(des) ? strWebDescription : des;

        Page.Header.Controls.Add(keywords);
        Page.Header.Controls.Add(description);
    }

    private void loadHouseRegion_rbt()
    {
        rbtHouseRegion.DataSource = DbHouseRegionEx.Select().Tables[0];
        rbtHouseRegion.DataTextField = "HouseRegionName";
        rbtHouseRegion.DataValueField = "HouseRegionID";
        rbtHouseRegion.DataBind();
        rbtHouseRegion.Items.Add(new ListItem("其它", "other"));
    }

    private void loadHouseGroup_rbt(string regionID)
    {
        rbtHouseGroup.Items.Add(new ListItem("请选择", "0"));
        rbtHouseGroup.DataSource = DbHouseGroupEx.Select(" and houseRegionID=" + regionID).Tables[0];
        rbtHouseGroup.DataTextField = "HouseGroupName";
        rbtHouseGroup.DataValueField = "HouseGroupID";
        rbtHouseGroup.DataBind();
    }

    private void loadHouseNumber_rbt(string groupID)
    {
        rbtHouseNumber.Items.Add(new ListItem("请选择", "0"));
        rbtHouseNumber.DataSource = DbHouseNumberEx.Select(" and HouseGroupID=" + groupID + " and HouseNumberType=0").Tables[0];
        rbtHouseNumber.DataTextField = "HouseNumberName";
        rbtHouseNumber.DataValueField = "HouseNumberID";
        rbtHouseNumber.DataBind();
    }

    private void loadHouseNumber1_rbt(string groupID)
    {
        rbtHouseNumber1.Items.Add(new ListItem("请选择", "0"));
        rbtHouseNumber1.DataSource = DbHouseNumberEx.Select(" and HouseGroupID=" + groupID + " and HouseNumberType=1").Tables[0];
        rbtHouseNumber1.DataTextField = "HouseNumberName";
        rbtHouseNumber1.DataValueField = "HouseNumberID";
        rbtHouseNumber1.DataBind();
    }

    private void loadHouseNumber2_rbt(string groupID)
    {
        rbtHouseNumber2.Items.Add(new ListItem("请选择", "0"));
        rbtHouseNumber2.DataSource = DbHouseNumberEx.Select(" and HouseGroupID=" + groupID + " and HouseNumberType=2").Tables[0];
        rbtHouseNumber2.DataTextField = "HouseNumberName";
        rbtHouseNumber2.DataValueField = "HouseNumberID";
        rbtHouseNumber2.DataBind();
    }


    #region 选幼儿园
    protected void rbtNurserySchool_OnSelectedIndexChanged(object sender, EventArgs e)
    {
        //rbtNurserySchool.Items.Add(new ListItem("龙岗区机关幼儿园本部", "0"));
        //rbtNurserySchool.Items.Add(new ListItem("龙岗区机关幼儿园龙城分园", "1"));
        //rbtNurserySchool.Items.Add(new ListItem("龙岗区机关幼儿园南湾分园", "2"));
        //rbtNurserySchool.Items.Add(new ListItem("龙岗区机关幼儿园坂田分园", "3"));
        switch (rbtNurserySchool.SelectedValue)
        {
            case "0":
                {
                    rblClass.Items.Clear();
                    rblClass.Items.Add(new ListItem("小班", "0"));

                }
                break;
            case "1":
                {
                    rblClass.Items.Clear();
                    rblClass.Items.Add(new ListItem("小班", "0"));
                }
                break;
            case "2":
                {
                    rblClass.Items.Clear();
                    rblClass.Items.Add(new ListItem("小班", "0"));
                    rblClass.Items.Add(new ListItem("中班", "1"));
                    rblClass.Items.Add(new ListItem("大班", "2"));
                }
                break;
            case "3":
                {
                    rblClass.Items.Clear();
                    rblClass.Items.Add(new ListItem("小班", "0"));
                    //rblClass.Items.Add(new ListItem("大班", "2"));
                }
                break;
        }
    }
    #endregion
}
